#include <iostream>
#include <boost/lexical_cast.hpp>

using std::cout;
using std::endl;
using std::string;

string
dec_to_bin(string in)
{
    int x = boost::lexical_cast<int>(in);

    if (x == 0)
    {
        return "0";
    }

    string out = "";

    while (x > 0)
    {
        switch(x % 2) {
        case 0 : out = "0" + out; break;
        case 1 : out = "1" + out; break;
        };

        x >>= 1;
    }

    return out;
}

int
main(int argc, char **argv)
{
    cout << dec_to_bin("0") << endl;
    cout << dec_to_bin("1") << endl;
    cout << dec_to_bin("2") << endl;
    cout << dec_to_bin("3") << endl;
    cout << dec_to_bin("4") << endl;
    cout << dec_to_bin("5") << endl;
    cout << dec_to_bin("6") << endl;
    cout << dec_to_bin("7") << endl;
}
